
<script type="text/javascript"><!--
var form = "";
var submitted = false;
var error = false;
var error_message = "";

function formSubmit() {
  if (submitted == true) {
    alert("This form has already been submitted. Please press Ok and wait for this process to be completed.");
    return false;
  }

  error = false;
  form = document.cart_quantity;
  form.actionForm.value = 'submit';
	submitted = true;	
	form.submit();
	return true;
}
//--></script>
<div id="bodyContent" class="grid_16 push_4">
	<h1>Checking out Form</h1>
	<form name="cart_quantity"
		action="<{$APPLICATION_URL}>/<{$ownerName}>Product/updateCart"
		method="post">
		<div class="contentContainer">			
			<div class="contentText">
				<table border="0" width="100%" cellspacing="0" cellpadding="0">
					<{if $countCartList > 0}>
					<{assign var=i value=0}>	
					<{assign var=totalPrice value=0}>
					<{foreach item=cartItem from=$cartList}>
					<{assign var=product value=$cartItem->getProduct()}>
					<{assign var=customer value=$cartItem->getCustomer()}>
					<{assign var=finalPrice value=$cartItem->finalPrice}>					
					<tr>
						<td valign="top">
							<table border="0" cellspacing="2" cellpadding="2">
								
								<tr>
									<td align="center"><a
										href="<{$APPLICATION_URL}>/<{$ownerName}>Product/details/id/<{$product->id}>"><img
											src="<{$product->getThumb()}>"
											alt="<{$product->getName()}>"
											title=" <{$product->getName()}>" width="100"
											height="80" /> </a></td>
									<td valign="top">
									<a href="<{$APPLICATION_URL}>/<{$ownerName}>Product/details/id/<{$product->id}>"><strong><{$product->getName()}></strong> </a><br /> <br /> <input
										type="text" name="quantity<{$i}>" value="<{$cartItem->quantity}>" size="4"
										style="width: 30px" /><span class="tdbLink"><div id="tdb<{$i}>" onclick="return formSubmit();">Update</div>
									</span> <script type="text/javascript">$("#tdb<{$i}>").button({icons:{primary:"ui-icon-refresh"}}).addClass("ui-priority-secondary").parent().removeClass("tdbLink");</script>&nbsp;&nbsp;&nbsp;or
										<a
										href="<{$APPLICATION_URL}>/<{$ownerName}>Product/removeCart/id/<{$product->id}>">remove</a>
									</td>
								</tr>
							</table>
						</td>
						<td align="right" valign="top"><strong><{$currencySymbol}><{$cartItem->finalPrice|string_format:"%.2f"}></strong></td>
					</tr>
					<{assign var=i value=$i+1}>	
								<{assign var=totalPrice value=$totalPrice+$finalPrice}>
								<{/foreach}>
					<{else}>			
					<tr>
						<td>
							Your cart is empty now. Please back to our shop and buy somethings. 
						</td>
					</tr>
					<{/if}>
				</table>
			</div>
		</div>
		<input type="hidden" id="actionForm" name="actionForm" value=""/>
		<input type="hidden" id="totals" name="totals" value="<{$countCartList}>"/>
	</form>
	<{if $countCartList > 0}>
	<p align="right">
		<strong>Sub-Total: $<{$totalPrice|string_format:"%.2f"}></strong>		
	</p>
	<div class="buttonSet">
		<span class="buttonAction"><span class="tdbLink"><a id="tdb5"
				href="<{$APPLICATION_URL}>/<{$ownerName}>Product/checkoutShipping">Continue</a>
		</span> <script type="text/javascript">$("#tdb5").button({icons:{primary:"ui-icon-triangle-1-e"}}).addClass("ui-priority-primary").parent().removeClass("tdbLink");</script>
		</span>
	</div>
	<{/if}>
</div>
